import java.util.Arrays;

public class myStack {
    private int top;
    private int[] stack;
    public myStack(int size) {
        stack = new int[size];
    }
    public int getTop(){
        return top;
    }
    public boolean isEmpty(){
        return top == 0;
    }

    public void push(int data) {
        if (top == stack.length) {
            this.stack = Arrays.copyOf(stack, stack.length * 2);
        }
        stack[top++] = data;
    }

    public boolean isFull() {
        return top == stack.length;
    }

    public int pop() {
        if (top == 0) {
            return -1;
        }
        return stack[--top];
    }

    public int peek() {
        if (top == 0) {
            return -1;
        }
        return stack[top-1];
    }
}
